package com.yzt.zhuju.widget.recorddown;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

public class RecordDownLinearLayout extends LinearLayout {

    private float downX;
    private float downY;

    public RecordDownLinearLayout(Context context) {
        super(context);
    }

    public RecordDownLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public RecordDownLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public RecordDownLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            downX = ev.getX();
            downY = ev.getY();
        }
        return super.dispatchTouchEvent(ev);
    }

    public float getLastDownX() {
        return downX;
    }

    public float getLastDownY() {
        return downY;
    }
}
